#! /bin/sh  
# chkconfig: 345 99 10
# -------------------------------------------------------------------------
# Fichier : dbora
#
# Auteur : memodba
# Societe: 
# Date : 27/01/2014
# Application : 
# Version : 1.0.0
# Description : Arret/redemarrage des bases oracle au boot
# Emplacement : /app/script/init.d/
#      ln -s /app/script/init.d/dbora /etc/init.d/dbora  
# 	   chkconfig --add dbora
#
# Modifications :
#	1.0.0 <27/01/2014> <LMR> : <Creation>
#	1.0.1 <27/01/2014> <LMR> : <Modification utilisation de dbstart/dbshut >
# -------------------------------------------------------------------------

ORA_HOME=/app/oracle/product/11g
ORA_OWNER=oracle
export ORACLE_UNQNAME=db11gr2

if [ ! -f $ORA_HOME/bin/dbstart ]
then
    echo "Oracle startup: cannot start"
    exit
fi

case "$1" in
    'start')
        # Start the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        # Remove "&" if you don't want startup as a background process.
        su $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME" 
        touch /var/lock/subsys/dbora
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login 
        # will not prompt the user for any values
        su $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"
        rm -f /var/lock/subsys/dbora
        ;;
esac